<?php

/**
 * @name: HOTN Sponsor
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnsponsor/
 */

if ( ($_POST['hotn_sponsor_money']<>"") && ($_POST['hont_sponsor_user']<>"") )
{
	if ($_POST['hotn_sponsor_minus'] == "1")
		$_POST['hotn_sponsor_minus'] = 1;
	else
		$_POST['hotn_sponsor_minus'] = 0;
	
	$data = array(
		"hont_sponsor_money_user" => $_POST['hont_sponsor_user'],
		"hotn_sponsor_money_money" => $_POST['hotn_sponsor_money'],
		"hotn_sponsor_money_minus" => $_POST['hotn_sponsor_minus']
	);
	$sql->db_Insert("hotn_sponsor_money",$data,FALSE);
}

$title .= " - ".HOTN_SPONSOR_ADMIN_MENU_SPONSOR;

$text ="
	<form method='post' action='".$PHP_SELF."'>
		<table class='fborder'>
			<tr>
				<td class='forumheader3'>
					".HOTN_SPONSOR_ADMIN_SPONSOR_ADD_USER."
				</td>
				<td class='forumheader3' style='text-align: center;'>
					<select class='tbox' name='hont_sponsor_user'>
						<option value='0'>".HOTN_SPONSOR_ADMIN_SPONSOR_UNKNOWN."</option>";

	$sql->db_Select("user", "user_name, user_id", "ORDER BY user_name ASC","non-default");
	while ($row = $sql->db_Fetch())
	{
		$text .= "<option value='".$row['user_id']."'>".$row['user_name']."</option>";
	}

$text .= "			</selected>
				</td>
			</tr>
			<tr>
				<td class='forumheader3'>
					".HOTN_SPONSOR_ADMIN_SPONSOR_MINUS."
				</td>
				<td class='forumheader3'>
					<input type='checkbox' class='tbox' name='hotn_sponsor_minus' value='1' />
				</td>
			</tr>
			<tr>
				<td class='forumheader3'>
					".HOTN_SPONSOR_ADMIN_SPONSOR_ADD_MONEY."
				</td>
				<td class='forumheader3'>
					<input type='text' name='hotn_sponsor_money' class='tbox' />
				</td>
			</tr>
			<tr>
				<td colspan='2' style='text-align: center;' class='forumheader' >
					<input type='submit' value='".HOTN_SPONSOR_ADMIN_SPONSOR_ADD_SUBMIT."' class='tbox' />
				</td>
			</tr>
		</table>
	</form>
";

?>